/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package chromafinal;

import java.awt.*;
/**
 *
 * @author Benjamin
 */
public class Bullet extends DynamicBall{

    Boss boss;
    boolean alive;


    public Bullet(double x, double y, int m, int size0, int num0, Boss daddy, Color color)
    {
        super(x,y,m,size0,num0, color);
        if (m > 0)
            cnum = 1;
        else
            cnum = -1;
        boss = daddy;
        alive = true;
    }


    public void move(int period)
    {
        super.move(period);

        if (xl < 0 || xl > 700 || xl < 0 || xl > 700 )
            alive = false;

        if (Math.pow(Math.pow(xl - boss.xl,2) + Math.pow(yl-boss.yl,2),0.5) <
                (size/2 + boss.size/2))
        {
            alive = false;
            boss.damage();
        }

    }

    public void pushPlayer(Player p)
    {
        super.push(p);
        if (dist(p) < (size/2 + p.size/2))
        {
            p.die();
            alive = false;
        }

    }

}
